package com.lugea.common.json;

import java.io.IOException;

import org.joda.time.DateTime;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.ser.std.StdScalarSerializer;

/**
 * @author enluw
 * @date 2020-01-27
 * @描述
 */
public class DateTimeStdScalarSerializer extends StdScalarSerializer<DateTime> {
    private static final long serialVersionUID = -6877706161468412636L;

    protected DateTimeStdScalarSerializer() {
        super(DateTime.class);
    }

    @Override
    public void serialize(DateTime dateTime, JsonGenerator jsonGenerator, SerializerProvider serializerProvider)
            throws IOException {
        jsonGenerator.writeString(dateTime.toString());
    }
}
